<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<center>
    <form action="{url:/exam/register}" method="post">
        用户名: <input type="text" name="name" id="name"><br>
        密码 : <input type="password" name="pwd" id="pwd"><br>
        邮箱 : <input type="email" name="email" id="email"><br>
        <input type="button" id="btn" value="注册">
    </form>
</center>
</body>
</html>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
    $("#btn").click(function(){
        var name = $("#name").val();
        var pwd = $("#pwd").val();
        var email = $("#email").val();
        if(name =="" || pwd=="" || email==""){
            alert("输入内容为空");
            return false;
        }
        var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if (!filter.test(email)){
            alert("您的电子邮件格式不正确");
            return false;
        }
        $("form").submit();
    })
</script>